#ifndef _LOOKUP_H_
#define _LOOKUP_H_

#include "stm32f10x.h"

// LCD 16x2 bar graph character
uint8_t bar_graph[][8] = 
{ 
	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F },
	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F },
	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F },
	{ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F },
	{ 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F },
	{ 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F },
	{ 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F },
	{ 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F }
};

// Cosine and sine lookup value
// Generated using this code:
//		for (i = 0; i < N_FREQ; i++)
//		{
//			for (j = 0; j < N_TIME; j++)
//			{
//				cos_val[lookup_idx] = cos(2*PI*i*j/N_TIME);
//				sin_val[lookup_idx] = sin(2*PI*i*j/N_TIME);
//				lookup_idx++;
//			}
//		}
const float cos_lookup[] =
{
    1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
    1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
    1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
    1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000,
    1.000, 0.981, 0.924, 0.832, 0.707, 0.556, 0.383, 0.195,
    0.000, -0.195, -0.382, -0.555, -0.707, -0.831, -0.924, -0.981,
    -1.000, -0.981, -0.924, -0.832, -0.708, -0.556, -0.383, -0.196,
    -0.001, 0.194, 0.382, 0.555, 0.706, 0.831, 0.923, 0.981,
    1.000, 0.924, 0.707, 0.383, 0.000, -0.382, -0.707, -0.924,
    -1.000, -0.924, -0.708, -0.383, -0.001, 0.382, 0.706, 0.923,
    1.000, 0.924, 0.708, 0.384, 0.001, -0.381, -0.706, -0.923,
    -1.000, -0.925, -0.708, -0.385, -0.002, 0.381, 0.706, 0.923,
    1.000, 0.832, 0.383, -0.195, -0.707, -0.981, -0.924, -0.556,
    -0.001, 0.555, 0.923, 0.981, 0.708, 0.197, -0.381, -0.831,
    -1.000, -0.833, -0.385, 0.193, 0.706, 0.980, 0.925, 0.558,
    0.003, -0.553, -0.923, -0.981, -0.709, -0.198, 0.380, 0.830,
    1.000, 0.707, 0.000, -0.707, -1.000, -0.708, -0.001, 0.706,
    1.000, 0.708, 0.001, -0.706, -1.000, -0.708, -0.002, 0.706,
    1.000, 0.709, 0.003, -0.705, -1.000, -0.709, -0.003, 0.705,
    1.000, 0.710, 0.004, -0.704, -1.000, -0.710, -0.004, 0.704,
    1.000, 0.556, -0.382, -0.981, -0.708, 0.194, 0.923, 0.832,
    0.001, -0.831, -0.925, -0.197, 0.706, 0.981, 0.385, -0.553,
    -1.000, -0.558, 0.380, 0.980, 0.710, -0.191, -0.922, -0.834,
    -0.004, 0.829, 0.926, 0.200, -0.703, -0.982, -0.388, 0.551,
    1.000, 0.383, -0.707, -0.924, -0.001, 0.923, 0.708, -0.381,
    -1.000, -0.385, 0.706, 0.925, 0.003, -0.923, -0.709, 0.380,
    1.000, 0.386, -0.704, -0.925, -0.004, 0.922, 0.711, -0.378,
    -1.000, -0.388, 0.703, 0.926, 0.006, -0.921, -0.712, 0.376,
    1.000, 0.195, -0.924, -0.556, 0.706, 0.832, -0.381, -0.981,
    -0.002, 0.980, 0.385, -0.830, -0.709, 0.553, 0.925, -0.191,
    -1.000, -0.199, 0.922, 0.560, -0.703, -0.834, 0.377, 0.982,
    0.006, -0.980, -0.389, 0.828, 0.712, -0.549, -0.927, 0.187,
    1.000, 0.000, -1.000, -0.001, 1.000, 0.001, -1.000, -0.002,
    1.000, 0.003, -1.000, -0.003, 1.000, 0.004, -1.000, -0.004,
    1.000, 0.005, -1.000, -0.006, 1.000, 0.006, -1.000, -0.007,
    1.000, 0.007, -1.000, -0.008, 1.000, 0.009, -1.000, -0.009,
    1.000, -0.195, -0.924, 0.555, 0.708, -0.831, -0.385, 0.980,
    0.003, -0.981, 0.380, 0.834, -0.704, -0.559, 0.922, 0.200,
    -1.000, 0.190, 0.926, -0.550, -0.712, 0.828, 0.389, -0.979,
    -0.008, 0.982, -0.375, -0.836, 0.700, 0.564, -0.920, -0.205,
    1.000, -0.382, -0.708, 0.923, 0.001, -0.925, 0.706, 0.385,
    -1.000, 0.380, 0.710, -0.922, -0.004, 0.926, -0.703, -0.388,
    1.000, -0.377, -0.712, 0.921, 0.007, -0.927, 0.701, 0.391,
    -1.000, 0.374, 0.714, -0.920, -0.010, 0.928, -0.699, -0.393,
    1.000, -0.555, -0.383, 0.981, -0.706, -0.197, 0.925, -0.830,
    -0.003, 0.834, -0.922, 0.191, 0.711, -0.980, 0.377, 0.561,
    -1.000, 0.550, 0.389, -0.982, 0.701, 0.203, -0.927, 0.826,
    0.010, -0.837, 0.920, -0.184, -0.715, 0.978, -0.371, -0.566,
    1.000, -0.707, -0.001, 0.708, -1.000, 0.706, 0.003, -0.709,
    1.000, -0.704, -0.004, 0.711, -1.000, 0.703, 0.006, -0.712,
    1.000, -0.702, -0.008, 0.713, -1.000, 0.700, 0.010, -0.714,
    1.000, -0.699, -0.012, 0.716, -1.000, 0.698, 0.013, -0.717,
    1.000, -0.831, 0.382, 0.197, -0.708, 0.981, -0.923, 0.553,
    0.004, -0.559, 0.926, -0.980, 0.703, -0.189, -0.389, 0.835,
    -1.000, 0.827, -0.375, -0.204, 0.714, -0.983, 0.920, -0.546,
    -0.012, 0.566, -0.929, 0.978, -0.698, 0.181, 0.396, -0.840,
    1.000, -0.924, 0.706, -0.381, -0.002, 0.385, -0.709, 0.925,
    -1.000, 0.922, -0.703, 0.377, 0.006, -0.389, 0.712, -0.927,
    1.000, -0.920, 0.700, -0.374, -0.010, 0.393, -0.715, 0.928,
    -1.000, 0.919, -0.698, 0.370, 0.015, -0.397, 0.718, -0.930,
    1.000, -0.981, 0.923, -0.831, 0.706, -0.553, 0.380, -0.191,
    -0.004, 0.200, -0.388, 0.561, -0.712, 0.835, -0.927, 0.982,
    -1.000, 0.979, -0.920, 0.826, -0.699, 0.546, -0.371, 0.183,
    0.013, -0.209, 0.396, -0.568, 0.718, -0.840, 0.930, -0.984,
    1.000, -1.000, 1.000, -1.000, 1.000, -1.000, 1.000, -1.000,
    1.000, -1.000, 1.000, -1.000, 1.000, -1.000, 1.000, -1.000,
    1.000, -1.000, 1.000, -1.000, 1.000, -1.000, 1.000, -1.000,
    1.000, -1.000, 1.000, -1.000, 1.000, -1.000, 1.000, -1.000
};
const float sin_lookup[] =
{
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
    0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
    0.000, 0.195, 0.383, 0.555, 0.707, 0.831, 0.924, 0.981,
    1.000, 0.981, 0.924, 0.832, 0.707, 0.556, 0.383, 0.196,
    0.001, -0.194, -0.382, -0.555, -0.707, -0.831, -0.924, -0.981,
    -1.000, -0.981, -0.924, -0.832, -0.708, -0.556, -0.384, -0.196,
    0.000, 0.383, 0.707, 0.924, 1.000, 0.924, 0.707, 0.383,
    0.001, -0.382, -0.707, -0.924, -1.000, -0.924, -0.708, -0.384,
    -0.001, 0.382, 0.706, 0.923, 1.000, 0.924, 0.708, 0.384,
    0.002, -0.381, -0.706, -0.923, -1.000, -0.925, -0.709, -0.385,
    0.000, 0.555, 0.924, 0.981, 0.707, 0.196, -0.382, -0.831,
    -1.000, -0.832, -0.384, 0.194, 0.706, 0.981, 0.924, 0.557,
    0.002, -0.554, -0.923, -0.981, -0.709, -0.197, 0.380, 0.830,
    1.000, 0.833, 0.385, -0.192, -0.705, -0.980, -0.925, -0.558,
    0.000, 0.707, 1.000, 0.707, 0.001, -0.707, -1.000, -0.708,
    -0.001, 0.706, 1.000, 0.708, 0.002, -0.706, -1.000, -0.709,
    -0.002, 0.705, 1.000, 0.709, 0.003, -0.705, -1.000, -0.710,
    -0.004, 0.704, 1.000, 0.710, 0.004, -0.704, -1.000, -0.710,
    0.000, 0.831, 0.924, 0.196, -0.707, -0.981, -0.384, 0.554,
    1.000, 0.557, -0.381, -0.980, -0.709, 0.193, 0.923, 0.833,
    0.003, -0.830, -0.925, -0.199, 0.704, 0.982, 0.386, -0.552,
    -1.000, -0.559, 0.378, 0.980, 0.711, -0.190, -0.922, -0.835,
    0.000, 0.924, 0.707, -0.382, -1.000, -0.384, 0.706, 0.924,
    0.002, -0.923, -0.709, 0.380, 1.000, 0.385, -0.705, -0.925,
    -0.004, 0.922, 0.710, -0.379, -1.000, -0.387, 0.704, 0.926,
    0.005, -0.922, -0.711, 0.377, 1.000, 0.389, -0.702, -0.926,
    0.000, 0.981, 0.383, -0.831, -0.708, 0.554, 0.924, -0.193,
    -1.000, -0.197, 0.923, 0.558, -0.705, -0.833, 0.379, 0.982,
    0.004, -0.980, -0.387, 0.829, 0.711, -0.551, -0.926, 0.189,
    1.000, 0.201, -0.921, -0.561, 0.702, 0.836, -0.375, -0.982,
    0.000, 1.000, 0.001, -1.000, -0.001, 1.000, 0.002, -1.000,
    -0.002, 1.000, 0.003, -1.000, -0.004, 1.000, 0.004, -1.000,
    -0.005, 1.000, 0.005, -1.000, -0.006, 1.000, 0.007, -1.000,
    -0.007, 1.000, 0.008, -1.000, -0.008, 1.000, 0.009, -1.000,
    0.000, 0.981, -0.382, -0.832, 0.706, 0.557, -0.923, -0.197,
    1.000, -0.192, -0.925, 0.553, 0.710, -0.829, -0.387, 0.980,
    0.005, -0.982, 0.377, 0.835, -0.702, -0.561, 0.921, 0.203,
    -1.000, 0.187, 0.927, -0.548, -0.714, 0.826, 0.392, -0.979,
    0.000, 0.924, -0.707, -0.384, 1.000, -0.381, -0.709, 0.923,
    0.003, -0.925, 0.704, 0.386, -1.000, 0.378, 0.711, -0.922,
    -0.006, 0.926, -0.702, -0.389, 1.000, -0.375, -0.713, 0.921,
    0.009, -0.927, 0.700, 0.392, -1.000, 0.373, 0.715, -0.919,
    0.000, 0.832, -0.924, 0.194, 0.708, -0.980, 0.380, 0.558,
    -1.000, 0.553, 0.386, -0.982, 0.704, 0.200, -0.926, 0.828,
    0.007, -0.835, 0.921, -0.187, -0.713, 0.979, -0.374, -0.563,
    1.000, -0.547, -0.392, 0.983, -0.699, -0.207, 0.928, -0.824,
    0.000, 0.707, -1.000, 0.706, 0.002, -0.709, 1.000, -0.705,
    -0.004, 0.710, -1.000, 0.704, 0.005, -0.711, 1.000, -0.702,
    -0.007, 0.712, -1.000, 0.701, 0.009, -0.714, 1.000, -0.700,
    -0.011, 0.715, -1.000, 0.699, 0.012, -0.716, 1.000, -0.697,
    0.000, 0.556, -0.924, 0.981, -0.706, 0.193, 0.385, -0.833,
    1.000, -0.829, 0.378, 0.200, -0.711, 0.982, -0.921, 0.550,
    0.008, -0.562, 0.927, -0.979, 0.700, -0.185, -0.392, 0.838,
    -1.000, 0.825, -0.371, -0.208, 0.717, -0.983, 0.918, -0.543,
    0.000, 0.383, -0.708, 0.924, -1.000, 0.923, -0.705, 0.379,
    0.004, -0.387, 0.711, -0.926, 1.000, -0.921, 0.702, -0.375,
    -0.008, 0.391, -0.714, 0.928, -1.000, 0.920, -0.699, 0.372,
    0.012, -0.395, 0.717, -0.929, 1.000, -0.918, 0.696, -0.368,
    0.000, 0.196, -0.384, 0.557, -0.709, 0.833, -0.925, 0.982,
    -1.000, 0.980, -0.922, 0.828, -0.702, 0.550, -0.375, 0.187,
    0.009, -0.204, 0.392, -0.564, 0.715, -0.838, 0.928, -0.983,
    1.000, -0.978, 0.918, -0.823, 0.696, -0.542, 0.367, -0.178,
    0.000, 0.001, -0.001, 0.002, -0.002, 0.003, -0.004, 0.004,
    -0.005, 0.005, -0.006, 0.007, -0.007, 0.008, -0.008, 0.009,
    -0.009, 0.010, -0.011, 0.011, -0.012, 0.012, -0.013, 0.014,
    -0.014, 0.015, -0.015, 0.016, -0.017, 0.017, -0.018, 0.018
};

#endif
